package ui;


import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;

import ui.handlers.MenuHandler;

public class ManagerHomeScreen extends BaseScreen{

	private JFrame mainFrame;
	
	private JButton editMenu_btn, editCoupons_btn;
	private JButton setDailySpecial_btn, dollarsPerPoint_btn;
	
	/* methods used for getting button objects for handlers */
	
	public JButton getEditMenuButton()
	{ return editMenu_btn; }
	
	public JButton getSetDailySpecialButton()
	{ return setDailySpecial_btn; }
	
	/* END OF BUTTON METHODS */
	
	public ManagerHomeScreen()
	{
		mainFrame = new JFrame();
		mainFrame.setTitle("Manager: Home Screen");
		mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		mainFrame.setSize(650, 550);
		mainFrame.setLayout(new GridLayout(3, 1));
		
		mainFrame.add(new JPanel()); //empty panel
		doTitle();
		doButtons();
		mainFrame.setVisible(true);
	}
	
	private void doTitle()
	{
		String title = "<HTML><FONT SIZE = \"6\">" +
				"Manager Home Screen</FONT></HTML>";
		JLabel title_lbl = new JLabel(title);
		JPanel title_panel = new JPanel();
		title_panel.add(title_lbl);
		
		mainFrame.add(title_panel);
	}
	
	private void doButtons()
	{		
		editMenu_btn = new JButton("Edit Menu");
		editMenu_btn.addActionListener(new MenuHandler(this));
		
		setDailySpecial_btn = new JButton("Set Daily Special");
		setDailySpecial_btn.addActionListener(new MenuHandler(this));
		
		editCoupons_btn = new JButton("Edit Coupons");
		editCoupons_btn.addActionListener(new MenuHandler(this));
		
		dollarsPerPoint_btn = new JButton("Define Dollars per Point");
		dollarsPerPoint_btn.addActionListener(new MenuHandler(this));
		
		JPanel editMenu_panel = new JPanel();
		JPanel editCoupons_panel = new JPanel();
		JPanel setDailySpecial_panel = new JPanel();
		JPanel dollarsPerPoint_panel = new JPanel();
		
		editMenu_panel.add(editMenu_btn);
		editCoupons_panel.add(editCoupons_btn);
		setDailySpecial_panel.add(setDailySpecial_btn);
		dollarsPerPoint_panel.add(dollarsPerPoint_btn);
		
		JPanel button_panel = new JPanel();
		button_panel.setLayout(new GridLayout(4, 1));
		button_panel.setBorder(new EmptyBorder(0, 0, 25, 0));
		button_panel.add(editMenu_panel);
		button_panel.add(editCoupons_panel);
		button_panel.add(setDailySpecial_panel);
		button_panel.add(dollarsPerPoint_panel);
		
		mainFrame.add(button_panel);
	}
	
}